<?php
/**
 * Created by PhpStorm.
 * User: Yangjinlei
 * Date: 2018/7/7
 * Time: 16:54
 */

namespace app\logic;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\DbException;


/**
 * @property \app\models\User model
 */
class User
{
    public function __construct(\app\models\User $model)
    {
        $this->model = $model;
    }

    public function login($name,$password){

    }

    /**
     * @param $name
     * @return array|\PDOStatement|string|\think\Model
     * @throws DbException
     */
    protected function getUserByName($name){
        try {
            return $this->model->where('name', $name)->findOrFail();
        } catch (DataNotFoundException $e) {
        } catch (ModelNotFoundException $e) {
        }
    }
}